-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved atVersion.supportedByAutomation
field handling
#1182
Conversation
atVersion.supportedByAutomation
field handling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very welcome addition! Had to do some special handling of this field in #1147 and this should make it a whole lot simpler.
I left small comments inline.
tpr.minimumAtVersion?.id === minimumAtVersion?.id && | ||
tpr.exactAtVersion?.id === exactAtVersion?.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To the best of my understanding, only one of these may exist at a time so conditionally checking may be good, with exactAtVersion
being the priority. Does that change your thoughts on this comparison?
I suppose it shouldn't matter though, since in the instance of the one (exact or minimum) that doesn't exist, undefined === undefined
will be evaluated to true anyways anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think it still makes sense because we are ensuring the Reports are a match and so if one has an undefined
minimum then the other would as well. One or the other is going to be a useless check since having only a minimum or a required is probably enforced elsewhere but I think it is a lower cognitive load to read than doing an OR
between those two.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough on the cognitive load, this is fine with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
server/resolvers/AtVersion/index.js
Outdated
const supportedByAutomationResolver = require('./supportedByAutomationResolver'); | ||
|
||
const AtVersion = { | ||
supportedByAutomation: supportedByAutomationResolver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: just for consistency, the other files in /resolvers
import the resolver as the expected attribute name, so const supportedByAutomation = require('./supportedByAutomationResolver');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for addressing the feedback
This PR adds a custom resolver for
atVersion.supportedByAutomation
that uses caching.